<?
if (!defined('baseinfo')) {
    exitdata();
}   
?>
<script src="<?=baseinfo?>/js/vendor/jquery.iuploader-1.0.js"></script>
<script src="<?=baseinfo?>/js/vendor/jquery.Jcrop.min.js"></script>
<script src="<?=baseinfo?>/js/coreadd.js"></script>
<link rel="stylesheet" href="<?=baseinfo?>/css/vendor/jcrop/jquery.Jcrop.min.css" type="text/css" />
<link rel="stylesheet" href="<?=baseinfo?>/css/theme1/coreadd.css" type="text/css" />
<link rel="stylesheet" href="<?=baseinfo?>/js/vendor/minified/themes/default.min.css" type="text/css" media="all" />


    <div class="ovlPopGen wrpPopPayWithPoint" style="display: none;">
        <div class="popGen posPop">
            <div class="topGen clBd2 bdBtm">
                <div class="wrpTtlGen ">
                    <h1 class="ttlGen clTxt2 fs05 cutTxt">Pay with Points</h1>
                </div>
                <div class="btnIco closeGen" onclick="$('.wrpPopPayWithPoint').fadeOut()">
                    <span class="ico icoCloseGen"></span>
                </div>
                <div class="topBgGen clBg3"></div>
            </div>
            <div class="bodyGen clBg3">
                <div class="bdPopPayWithPoint fs03">
                    <div class="spnPayPoint">
                        <span id="payitem">This item need 200 points.</span>
                        <span id="youritem">Now you have <?=number_format($data['mypoint'])?> Points.</span>
                    </div>
                    <div class="btnPayPoint">
                        <button class="btnPayPnt clTxtW clBgSp1 fs04" onclick="paywithpoint()">Pay with Points</button>
                        <span class="clErrTxt boldGen"></span>
                    </div>
                </div>


            </div>
        </div>
    </div>
    
    
    <div class="ovlPopGen wrpPopHtP"  style="display: none;" >
        <div class="popGen posPop">
            <div class="topGen clBd2 bdBtm">
                <div class="wrpTtlGen ">
                    <h1 class="ttlGen clTxt2 fs05 cutTxt">How to Pay</h1>
                </div>
                <div class="btnIco closeGen" onclick="$('.wrpPopHtP').fadeOut()">
                    <span class="ico icoCloseGen"></span>
                </div>
                <div class="topBgGen clBg3"></div>
            </div>
            <div class="bodyGen clBg3">
                <div class="bodyOutGen">
                    <div class="bodyInGen">
                        <div class="wrpFrmGen">
                            <div class="bodyHtP fs04 clTxt2">
                                <div class="shpNmOrdSum clBg1 clearfix showshopname">
                                    <a href="">
                                        <img src="img/dfthmbuser.jpg" class="genImgShp">
                                        <span class="cutTxt clTxt2 fs04" href="">Shop A</span>
                                    </a>
                                </div>
                                
                                
                                <div class="bdHtp">
                                    <div class="mtHtp clBg4">
                                        <div class="hdMtHtp clearfix">
                                            <span class="ttlMtHtp fs04 boldGen">Transfer</span>
                                            <button onclick="openpopuppayment()" class="btnMtHtp clTxtW clBgSp1 fs03">แจ้งชำระเงิน</button>
                                        </div>
                                        <div class="bdMtHtp fs03">
                                             <div class="hdTfHtp clBg2 clearfix">
                                                 <div class="tf tf1">
                                                     <span class="boldGen">Bank</span>
                                                 </div>
                                                 <div class="tf tf2">
                                                     <span class="boldGen">Branch</span>
                                                 </div>
                                                 <div class="tf tf3">
                                                     <span class="boldGen">Number</span>
                                                 </div>
                                                 <div class="tf tf4">
                                                     <span class="boldGen">Type</span>
                                                 </div>
                                                 <div class="tf tf5">
                                                     <span class="boldGen">Name</span>
                                                 </div>
                                             </div>
                                             <div class="bdTfHtp">

                                             </div>
                                        </div>
                                    </div>
                                    
                                    <div class="mtHtp clBg4">
                                        <div class="hdMtHtp">
                                            <span class="boldGen">Online Payment</span>
                                        </div>
                                        <div class="bdMtHtp fs03">
                                            <a class="btnPaypal paypalbtn" href="" target="_blank" >
                                                <span class="icoPayPal"></span>
                                            </a>
                                         <!--   <a class="btnPaypal btnt2p">
                                                <span class="icoScb"></span>
                                            </a>
                                            <a class="btnPaypal btnt2p">
                                                <span class="icoKsr"></span>
                                            </a>-->
                                        </div>
                                    </div>
                                    
                                    
                                    
                                </div>
                                
                            </div>
                        </div>
                    </div>
                </div>    
            </div>
        </div>
    </div>
    
    <div class="ovlPopGen wrpPopShipInfo" id="feature1"  style="display: none;">
      <form id="fullprofileform">
        <div class="popGen posPop">
            <div class="topGen clBd2 bdBtm">
                <div class="wrpTtlGen ">
                    <h1 class="ttlGen clTxt2 fs05 cutTxt">Shipping Information</h1>
                </div>
                <div class="btnIco closeGen" onclick="$('.wrpPopShipInfo').fadeOut()">
                    <span class="ico icoCloseGen"></span>
                </div>
                <div class="topBgGen clBg3"></div>
            </div>
            <div class="bodyGen clBg3">
                <div class="bodyOutGen">
                    <div class="bodyInGen">
                        <div class="wrpFrmGen">
                            <div class="bodyShipInfo fs04 clTxt2">
                                <div class="bdShipInfo">
                                    <div class="inpShipInfo clearfix">
                                        <span class="fs03">Name*</span>
                                        <input type="text" name="displayname" class="fs03 clBg5 clBd2 bdFull">
                                    </div>
                                    <div class="inpShipInfo clearfix">
                                        <span class="fs03">Email*</span>
                                        <input type="text" name="emailcontact" class="fs03 clBg5 clBd2 bdFull">
                                    </div>
                                    <div class="inpShipInfo clearfix">
                                        <span class="fs03">Tel*</span>
                                        <input type="text" name="phone" class="fs03 clBg5 clBd2 bdFull">
                                    </div>
                                    <div class="inpShipInfo clearfix">
                                        <span class="fs03">Street Address*</span>
                                        <textarea name="shipaddress" id="address-2" class="fs03 clBg5 clBd2 bdFull"></textarea>
                                    </div>
                                    <div class="inpShipInfo clearfix">
                                        <span class="fs03">Country*</span>
                                        <div class="reDesign">
                                            <select name="shipcountryid" id="countryid-2" class="fs01">
                                            <option  value="0">Please Select Country</option>
                                                   <?  
                                            if(count($data['countryall']))
                                            {
                                             foreach($data['countryall'] as $keycountry=> $countryall)
                                             {
                                             
                                        ?>
                                                <option  value="<?=$keycountry?>"><?=$countryall?></option>
                                        <?
                                             }
                                             
                                            }
                                        
                                          ?>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="inpShipInfo clearfix prothaiclass">
                                        <span class="fs03">Province*</span>
                                        <div class="reDesign">
                                            <select name="shipproid" id="proid-2" class="fs01">
                                            <option  value="0">Please Select Province</option>
                                                  <?if(count($data['provinceall'])){
                                         foreach($data['provinceall'] as $keyprovince=> $valueprovince)
                                         {
                                            
                                             
                                         ?>
                                        <option  value="<?=$keyprovince?>"><?=$valueprovince?></option>
                                        <?
                                         }
                                        
                                        }?>
                                            </select>
                                        </div>
                                    </div>
                                    <div class="inpShipInfo clearfix prothaiclass">
                                        <span class="fs03">District*</span>
                                        <div class="reDesign">
                                            <select name="shipdisid" id="disid-2" class="fs01">
                                        <option  value="0">Please Select District</option>
                                    </select>
                                        </div>
                                    </div>
                                    <div class="inpShipInfo clearfix prothaiclass">
                                        <span class="fs03">Sub District*</span>
                                        <div class="reDesign">
                                             <select name="shiptumid" id="tumid-2" class="fs01">
                                        <option  value="0">Please Select Sub District</option>
                                    </select>
                                        </div>
                                    </div>
                                    
                                    <div class="inpShipInfo clearfix prootherclass">
                                        <span class="fs03">State</span>
                                        <div class="reDesign">
                                           <input type="text" name="shipstate" id="state-2"  >
                                        </div>
                                    </div>
                                    
                                    <div class="inpShipInfo clearfix">
                                        <span class="fs03">Postal Code*</span>
                                        <input type="text" name="shipcode" id="code-2"  class="fs03 clBg5 clBd2 bdFull">
                                    </div>
                                </div>
                                <div class="btnShipInfo">
                                    <button type="button" onclick="saveshippingnew()" class="btnSmtShp clTxtW clBgBt1 fs04">Submit</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>    
            </div>
        </div>
         <input type="hidden" name="filter" value="1">
        </form>
    </div>
    
    <div class="ovlPopGen wrpPopOrdSum" style="display: none;">
        <div class="popGen posPop">
            <div class="topGen clBd2 bdBtm">
                <div class="wrpTtlGen ">
                    <h1 class="ttlGen clTxt2 fs05 cutTxt">Order Summary</h1>
                </div>
                <div class="btnIco closeGen" onclick="$('.wrpPopOrdSum').fadeOut()" >
                    <span class="ico icoCloseGen"></span>
                </div>
                <div class="topBgGen clBg3"></div>
            </div>
            <div class="bodyGen clBg3">
                <div class="bodyOutGen">
                    <div class="bodyInGen">
                        <div class="wrpFrmGen">
                            <div class="bodyOrdSum fs04 clTxt2">
                                <div class="shpNmOrdSum clBg1 clearfix showshopname">
                                    <a href="">
                                        <img src="img/dfthmbuser.jpg" class="genImgShp">
                                        <span class="cutTxt clTxt2 fs04 " href="">Shop A</span>
                                    </a>
                                </div>
                                <div class="wrpOrdSum">
                                    <div class="wrpHdTbCart clBg2">
                                        <div class="hdTbCart fs04 boldGen clearfix">
                                            <span class="ct os1">Product</span>
                                            <span class="ct os2">Price (Baht)</span>
                                            <span class="ct os3">Qty</span>
                                            <span class="ct os4">Amount (Baht)</span>
                                        </div>
                                    </div>
                                    
                                    <div class="wrpItmLstCart clBd2 bdBtm">
                                    
                                    <!--    <div class="itmLstCart fs03 clearfix clBd2">
                                            <div class="ct os1 clearfix">
                                                <div class="pdImgCart">
                                                    <img alt="img" src="img/testtn1.jpg">
                                                </div>
                                                <div class="pdNameCart">
                                                    <a class="boldGen" href="">Product Name Product Name Product Name Product Name</a>
                                                </div>
                                            </div>
                                            <div class="ct os2 clearfix"><span>100</span></div>
                                            <div class="ct os3 clearfix"><span>2</span></div>
                                            <div class="ct os4 clearfix"><span>0<em>(Pay with Points)</em></span></div>
                                        </div>-->
                                        
                                        
                                    </div>
                                    <div class="wrpCouponCart clBd2 bdBtm">
                                        <div class="hdCpCart">
                                            <span class="fs03 boldGen">Coupon</span>
                                        </div>
                                        <div class="coupondiv"></div>
                                        
                                    </div>
                                    <div class="wrpRcCart clBd2 bdBtm">
                                        <div class="hdRcCart">
                                            <span class="fs03 boldGen">วิธีรับสินค้า</span>
                                        </div>
                                        <div class="transportdiv"></div>
                                       <!-- <div class="itmLstCart fs03 clearfix clBd2">
                                            <div class="ct os10">
                                                <span>รับด้วยตนเอง</span>
                                            </div>
                                            <div class="ct os5"><span>0</span></div>
                                        </div>-->
                                    </div>
                                    <div class="wrpTotalCart">
                                        <div class="totalCart fs07 boldGen clearfix">
                                            <span class="ct os8">Total</span>
                                            <span class="ct os6 totalsettext">0</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="wrpShipOrd">
                                    <div class="hdShipInfo clBg2">
                                        <span class="boldGen">Shipping Information</span>
                                    </div>
                                    <div class="bdShipInfo fs03">
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Name</span>
                                            <span class="si2 displaynamecart">Nopp</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Email</span>
                                            <span class="si2 emailcart">Nopp@mail.com</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Tel</span>
                                            <span class="si2 phonecart">088-888-8888</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Address</span>
                                            <span class="si2 addresscart">3 Prachasongkroh 33 Din Daeng Bangkok 10400</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="moreInfoCart">
                                    <div class="hdMoreInfo clBg2">
                                        <span class="boldGen">More Information</span>
                                    </div>
                                    <div class="bdMoreInfo fs03">
                                        <textarea class="clBg5 clBd2 fs03 clTxt2" name="noteinfo"></textarea>
                                    </div>
                                </div>
                                <div class="btnOrdSum clearfix">
                                    <button class="btnBckOrdSum clTxtW clBgBt1 fs04">Back</button>
                                    <button class="btnCfmOrdSum clTxtW clBgSp1 fs04" onclick="saveordercart()">Confirm</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>    
            </div>
        </div>
    </div>
    
    <div class="ovlPopGen wrpPopTellPaid" id="feature1" style="display: none;">
        <div class="popGen posPop">
            <div class="topGen clBd2 bdBtm">
                <div class="wrpTtlGen ">
                    <h1 class="ttlGen clTxt2 fs05 cutTxt">แจ้งการชำระเงิน</h1>
                </div>
                <div class="btnIco closeGen" onclick="$('.wrpPopTellPaid').fadeOut()">
                    <span class="ico icoCloseGen"></span>
                </div>
                <div class="topBgGen clBg3"></div>
            </div>
            <div class="bodyGen clBg3">
                <div class="bodyOutGen">
                    <div class="bodyInGen">
                        <div class="wrpFrmGen">
                            <div class="bodyTellPaid fs04 clTxt2">
                                <div class="bdTellPaid">
                                    <div class="inpTellPaid clearfix">
                                        <span class="boldGen fs03">Order ID</span>
                                        <div class="tellPaidLst">
                                            <span class="btnTellPaidOrdView">ABC123456</span>
                                        </div>
                                    </div>
                                    <div class="inpTellPaid clearfix">
                                        <span class="boldGen fs03">Payment Channel*</span>
                                        <div class="tellPaidLst">
                                            <div class="bankLst">
                                                <input type="radio" checked="" name="paymet">
                                                <label>Transfer</label>
                                            </div>
                                            
                                        </div>
                                    </div>
                                    <div class="inpTellPaid clearfix">
                                        <span class="boldGen fs03">Deposit Account*</span>
                                        <div class="tellPaidLst banklistdata">
                                        <!--    <div class="bankLst">
                                                <input type="radio" checked="" name="bnkLst">
                                                <label>ธนาคารกรุงเทพ สาขาดินแดง 000-0-00000-0</label>
                                            </div>
                                            <div class="bankLst">
                                                <input type="radio" name="bnkLst">
                                                <label>ธนาคารกรุงเทพ สาขาดินแดง 000-0-00000-0</label>
                                            </div>-->
                                        </div>
                                    </div>
                                    <div class="inpTellPaid clearfix">
                                        <span class="boldGen fs03">Date*</span>
                                        <div class="tellPaidLst">
                                            <input type="text" name="datepay" class="fs03 clBg5 clBd2 bdFull">
                                        </div>
                                    </div>
                                    <div class="inpTellPaid clearfix">
                                        <span class="boldGen fs03">Time*</span>
                                        <div class="tellPaidLst">
                                            <div class="reDesign">
                                                <select name="timepay" class="fs01">
                                                    <option value="">hour</option>
                                                    <option value="00">00</option>
                                                    <option value="01">01</option>
                                                    <option value="02">02</option>
                                                    <option value="03">03</option>
                                                    <option value="04">04</option>
                                                    <option value="05">05</option>
                                                    <option value="06">06</option>
                                                    <option value="07">07</option>
                                                    <option value="08">08</option>
                                                    <option value="09">09</option>
                                                    <option value="10">10</option>
                                                    <option value="11">12</option>
                                                    <option value="13">13</option>
                                                    <option value="14">14</option>
                                                    <option value="15">15</option>
                                                    <option value="16">16</option>
                                                    <option value="17">17</option>
                                                    <option value="18">18</option>
                                                    <option value="19">19</option>
                                                    <option value="20">20</option>
                                                    <option value="21">21</option>
                                                    <option value="22">22</option>
                                                    <option value="23">23</option>
                                                </select>
                                            </div>
                                            <div class="reDesign">
                                                <select name="minpay" class="fs01">
                                                    <option value="">min</option>
                                                    <option value="00">00</option>
                                                    <option value="10">10</option>
                                                    <option value="20">20</option>
                                                    <option value="30">30</option>
                                                    <option value="40">40</option>
                                                    <option value="50">50</option>
                                                </select>
                                            </div>
                                        </div>
                                    </div>
                                    <div class="inpTellPaid clearfix">
                                        <span class="boldGen fs03">Amount (Baht)*</span>
                                        <div class="tellPaidLst">
                                            <input type="text" name="amountbaht" class="fs03 clBg5 clBd2 bdFull">
                                        </div>
                                    </div>
                                    <div class="inpTellPaid clearfix">
                                        <span class="boldGen fs03">More Details</span>
                                        <div class="tellPaidLst">
                                            <textarea name="moredetail" class="mreDt fs03 clBg5 clBd2 bdFull"></textarea>
                                        </div>
                                    </div>
                                    <div class="inpTellPaid clearfix image1">
                                        <span class="boldGen fs03">Proof of Payment</span>
                                        <div class="tellPaidLst wrpSlipAtm">
                                            <div class="slipAtm clBd2 clBg4 bdFull plgArea"></div>
                                            <div class="addTnTl clBd2 bdBtm">
                                                <div title="Browse" class="btnIco addImgTl clBd3 bdBtm uploadbutton">
                                                    <span class="ico icoAddImgTl"></span>
                                                    <div class="wrpUlFile">
                                                       <!-- <input type="file" class="ulFile">-->
                                                    </div>
                                                </div>
                                                <div title="Cloud" class="btnIco addCldTl clBd3 bdBtm cloudbutton">
                                                    <span class="ico icoAddCldTl"></span>
                                                </div>
                                                <div title="Link" class="btnIco addLnkTl clBd3 bdBtm linkbutton">
                                                    <span class="ico icoAddLnkTl"></span>
                                                </div>
                                                <div title="Remove" class="btnIco btnRmvTl deletebutton">
                                                    <span class="ico icoRmvTl"></span>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="btnShipInfo">
                                    <button onclick="sendpaymentuser()" class="clTxtW clBgSp1 fs04">Send</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>    
            </div>
        </div>
    </div>
    
    <div class="ovlPopGen wrpPopOrdCtmView" style="display: none;">
        <div class="popGen posPop">
            <div class="topGen clBd2 bdBtm">
                <div class="wrpTtlGen ">
                    <h1 class="ttlGen clTxt2 fs05 cutTxt ordertext">Order ID : ABC123456</h1>
                </div>
                <div class="btnIco closeGen" onclick="$('.wrpPopOrdCtmView').fadeOut()">
                    <span class="ico icoCloseGen"></span>
                </div>
                <div class="topBgGen clBg3"></div>
            </div>
            <div class="bodyGen clBg3">
                <div class="bodyOutGen">
                    <div class="bodyInGen">
                        <div class="wrpFrmGen">
                            <div class="bodyOrdView fs04 clTxt2">
                                <div class="ordCtmView clearfix clBg5">
                                    <div class="shpOrdCtmView clearfix displayshop">
                                        <a href=""><img src="img/dfthmbuser.jpg" class="genImgShp"><span class="cutTxt clTxt2 fs04" href="">Shop A</span></a>
                                    </div>
                                    <div class="sttsOrdCtmView">
                                        <span class="boldGen">Status : </span>
                                        <span class="statusorder">Reserve</span>
                                    </div>
                                    <div style="display:none" class="sttsOrdCtmView">
                                        <span class="boldGen">Status : </span>
                                        <span class="">Paid</span>
                                        <em>(Point)</em>
                                    </div>
                                    <div style="display:none" class="sttsOrdCtmView">
                                        <span class="boldGen">Status : </span>
                                        <span class="">Shipped</span>
                                        <em class="btnOrdHtrRef">(Ref No.)</em>
                                    </div>
                                    <div style="display:none" class="sttsOrdCtmView">
                                        <span class="boldGen">Status : </span>
                                        <span class="">Canceled</span>
                                    </div>
                                </div>
                                <div class="wrpDateChnOrdView clearfix">
                                    <div class="dateOrdView">
                                        <span class="boldGen">Order On :</span>
                                        <span class="orderdate">18:00:00 10/10/2014</span>
                                    </div>
                                    <div class="chnOrdView">
                                        <span class="boldGen">Order Channel :</span>
                                        <span>Online</span>
                                    </div>
                                </div>
                                
                                <div class="wrpOrdSum">
                                    <div class="wrpHdTbCart clBg2">
                                        <div class="hdTbCart fs04 boldGen clearfix">
                                            <span class="ct os1">Product</span>
                                            <span class="ct os2">Price (Baht)</span>
                                            <span class="ct os3">Qty</span>
                                            <span class="ct os4">Amount (Baht)</span>
                                        </div>
                                    </div>
                                    <div class="wrpItmLstCart clBd2 bdBtm cartitemwrp">
                                        
                                                                                
                                        
                                    </div>
                                    <div class="wrpCouponCart clBd2 bdBtm">
                                        <div class="hdCpCart">
                                            <span class="fs03 boldGen">Coupon</span>
                                        </div>
                                        <div class="conponcart">
                                        <div class="itmLstCart fs03 clearfix clBd2">
                                            <div class="ct os10 clearfix">
                                                <span>Coupon Name</span>
                                            </div>
                                            <div class="ct os4 clearfix"><span>-100</span></div>
                                        </div>
                                        </div>
                                        
                                    </div>
                                    <div class="wrpRcCart clBd2 bdBtm">
                                        <div class="hdRcCart">
                                            <span class="fs03 boldGen">วิธีรับสินค้า</span>
                                        </div>
                                        <div class="itmLstCart fs03 clearfix clBd2 transportproduct">
                                            <div class="ct os10">
                                                <span>รับด้วยตนเอง</span>
                                            </div>
                                            <div class="ct os5"><span>0</span></div>
                                        </div>
                                    </div>
                                    <div class="wrpTotalCart">
                                        <div class="totalCart fs07 boldGen clearfix">
                                            <span class="ct os8">Total</span>
                                            <span class="ct os6 totalpricedata">200</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="wrpShipOrd">
                                    <div class="hdShipInfo clBg2">
                                        <span class="boldGen">Shipping Information</span>
                                    </div>
                                    <div class="bdShipInfo fs03">
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Name</span>
                                            <span class="si2 displaynameshow">Nopp</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Email</span>
                                            <span class="si2 emailshow">Nopp@mail.com</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Tel</span>
                                            <span class="si2 phoneshow">088-888-8888</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Address</span>
                                            <span class="si2 addressshow">3 Prachasongkroh 33 Din Daeng Bangkok 10400</span>
                                        </div>
                                    </div>
                                </div>
                                <div class="wrpMoreOrd">
                                    <div class="hdShipInfo clBg2">
                                        <span class="boldGen">More Information</span>
                                    </div>
                                    <div class="bdShipInfo fs03">
                                        <span class="noteshow">Bla Bla Bla</span>
                                    </div>
                                </div>
                                <div class="wrpShipOrd">
                                    <div class="hdShipInfo clBg2">
                                        <span class="boldGen">Payment Information</span>
                                    </div>
                                    <div class="bdShipInfo fs03">
                                        <div class="noPay">
                                            
                                            <button class="btnCtmOrdViewHtP clBgSp1 clTxtW fs03 howtopaybtn">How to Pay</button>
                                        </div>
                                    </div>
                                    
                                    
                                    
                                    <div class="userpayshow" >
                                    <div class="bdShipInfo fs03">
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Inform Date</span>
                                            <span class="si2">11:00:00 10/10/2014</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Channel</span>
                                            <span class="si2">Bla Bla Bla</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Payment Date</span>
                                            <span class="si2">10/10/2013</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Payment Time</span>
                                            <span class="si2">10:10</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Amount</span>
                                            <span class="si2">200 Baht</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">More Details</span>
                                            <span class="si2">-</span>
                                        </div>
                                        <div class="showShipInfo clearfix">
                                            <span class="si1 boldGen">Attrach File</span>
                                            <span class="si2">-</span>
                                        </div>
                                    </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>    
            </div>
        </div>
    </div>
    

<script>
var shopid=0;
var productid=0;
var quantityset=0;
var orderid=0;
var suborderid=0;
var useridset=0;
var rownow=1;


$( document ).ready(function() {

$("#feature"+rownow+' select[name="shipcountryid"]').change(function() 
    { 
     
       swicthcountry($(this).val(),rownow);
    
    });
    
    
    $("#feature"+rownow+' select[name="shipproid"]').change(function() 
    { 
    
       getdistrict("#feature"+rownow+' select[name="shipdisid"]',"#feature"+rownow+' select[name="shiptumid"]',$(this).val());
    
    });
    
    $("#feature"+rownow+' select[name="shipdisid"]').change(function() 
    {
    gettumbon("#feature"+rownow+' select[name="shiptumid"]',$(this).val());
    
    });

imageset(1,350,350,150,150);
$( '.wrpPopTellPaid input[name="datepay"]' ).datepicker({dateFormat:'dd/mm/yy'});


<?if($_GET['orderid']){?>

changetabcart('wrprOrdHtr');
getorderlistbyorderid(<?=$_GET['orderid']?>);

<?}?>


});


function refnodata(orderid)
{
$.get(serviceinfo+'getrefnodata',{orderid:orderid}, function(data) {

$('.wrpPopShowRefNo .coderefno').html('');
$('.wrpPopShowRefNo .noterefno').html('');
if(data.data.code)
{
$('.wrpPopShowRefNo .coderefno').html(data.data.code);
$('.wrpPopShowRefNo .noterefno').html(data.data.note);
}

$('.wrpPopShowRefNo').fadeIn();

});

}

function imageset(rowgnowset,widthset,heightset,widthset2,heightset2)
{
var rownow=1;
var rowgnow=rowgnowset;
 
 $('#feature'+rownow+' .image'+rowgnow+' .uploadbutton').iuploader({
         'link':serviceinfo+'iupload',
         'accept':'image/*',
         'group':rowgnow,

         'type':['jpg', 'jpeg', 'png', 'gif'],
         'onUploadFinish':function(filename,filelink,setting){
         
         
         
         
         getpopupboxresize(widthset,heightset,filelink,setting['originalwidth'],setting['originalheight'],
         
         function(filename2,filelink2,width2,height2,imgmid2){
         var rowgnow2=setting['group'];        
         $('#feature'+rownow+' .image'+rowgnow2+' .plgArea').html('<a target="_blank" href="'+filelink+'?t='+Math.floor((Math.random()*100000)+1)+'"><img height="'+heightset2+'" width="'+widthset2+'" src="'+filelink2+'?t='+Math.floor((Math.random()*100000)+1)+'"></a>');
         $('#feature'+rownow+' .image'+rowgnow2+' input[name="filelink[]"]').val(filelink);
         $('#feature'+rownow+' .image'+rowgnow2+' input[name="filelinkcrop[]"]').val(filelink2);                 
         $('#feature'+rownow+' .image'+rowgnow2+' input[name="fileold[]"]').val(setting.fileold);      
         $("#width-"+setting.id).val(setting.originalwidth);
         $("#height-"+setting.id).val(setting.originalheight);      
         $("#imgmid-"+setting.id).val(setting.imgmid);       
         $("#simgmid-"+setting.id).val(imgmid2);               
         $("#widthcrop-"+setting.id).val(width2);
         $("#heightcrop-"+setting.id).val(height2);    
         
          closepopup();  
         }
         ,setting['imgmid']
         
         );
         //alert(filename);
         }
   });
  
  
   $('#feature'+rownow+' .image'+rowgnow+' .cloudbutton').click(function() {
          //console.log("testdata");
          //var rowgnow3=rowgnow;
          var rowgnow3=rowgnowset;
        //alert("Handler for .click() called.");
          getpopupcloud(
          function(filename2,filelink2,width2,height2,imgmid2,index2){ 

        $('#feature'+rownow+' .image'+rowgnow3+' .plgArea').html('<a target="_blank" href="'+$('#feature'+rownow+' .image'+rowgnow3+' input[name="filelink[]"]').val()+'?t='+Math.floor((Math.random()*100000)+1)+'"><img height="'+heightset2+'" width="'+widthset2+'" src="'+filelink2+'?t='+Math.floor((Math.random()*100000)+1)+'"></a>');
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="simgmid[]"]').val(imgmid2);
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="filelinkcrop[]"]').val(filelink2);                                    
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="widthcrop[]"]').val(width2);         
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="heightcrop[]"]').val(height2);

        closepopup();  

          
          },
          
          
          function(filename,filelink,width,height,imgmid,indexnow){
            
            $('#feature'+rownow+' .image'+rowgnow3+' input[name="filelink[]"]').val(filelink);
            $('#feature'+rownow+' .image'+rowgnow3+' input[name="imgmid[]"]').val(imgmid);           
            $('#feature'+rownow+' .image'+rowgnow3+' input[name="width[]"]').val(width);
            $('#feature'+rownow+' .image'+rowgnow3+' input[name="height[]"]').val(height);
            

          
          }
          ,
          rowgnow
          ,widthset
          ,heightset
          
          );

   });
   
   $('#feature'+rownow+' .image'+rowgnow+'  .deletebutton').click(function() {
   
   var rowgnow3=rowgnowset;
   

   $('#feature'+rownow+' .image'+rowgnow3+' .plgArea a').remove();
   
   $('#feature'+rownow+' .image'+rowgnow3+' input[name="filelink[]"]').val('');
   $('#feature'+rownow+' .image'+rowgnow3+' input[name="imgmid[]"]').val('');           
   $('#feature'+rownow+' .image'+rowgnow3+' input[name="width[]"]').val('');
   $('#feature'+rownow+' .image'+rowgnow3+' input[name="height[]"]').val('');
   
   
   
    $('#feature'+rownow+' .image'+rowgnow3+' input[name="simgmid[]"]').val('');
     $('#feature'+rownow+' .image'+rowgnow3+' input[name="filelinkcrop[]"]').val('');                                    
     $('#feature'+rownow+' .image'+rowgnow3+' input[name="widthcrop[]"]').val('');         
     $('#feature'+rownow+' .image'+rowgnow3+' input[name="heightcrop[]"]').val('');
   
   });
   
   $('#feature'+rownow+' .image'+rowgnow+' .linkbutton').click(function() {
   var rowgnow3=rowgnowset;
   //console.log("test");
   
   getpopuplink(
          function(filename2,filelink2,width2,height2,imgmid2,index2){ 
          
          
         $('#feature'+rownow+' .image'+rowgnow3+' .plgArea').html('<a target="_blank" href="'+$('#feature'+rownow+' .image'+rowgnow3+' input[name="filelink[]"]').val()+'?t='+Math.floor((Math.random()*100000)+1)+'"><img height="'+heightset2+'" width="'+widthset2+'" src="'+filelink2+'?t='+Math.floor((Math.random()*100000)+1)+'"></a>');
         
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="simgmid[]"]').val(imgmid2);
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="filelinkcrop[]"]').val(filelink2);                                    
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="widthcrop[]"]').val(width2);         
         $('#feature'+rownow+' .image'+rowgnow3+' input[name="heightcrop[]"]').val(height2);
        // $.colorbox.close("User added succesfully"); 
        closepopup();  
          
          },
          function(filename,filelink,width,height,imgmid,indexnow){
            

            $('#feature'+rownow+' .image'+rowgnow3+' input[name="filelink[]"]').val(filelink);
            $('#feature'+rownow+' .image'+rowgnow3+' input[name="imgmid[]"]').val(imgmid);           
            $('#feature'+rownow+' .image'+rowgnow3+' input[name="width[]"]').val(width);
            $('#feature'+rownow+' .image'+rowgnow3+' input[name="height[]"]').val(height);
            

          
          }
          ,
          rowgnow
          ,widthset
          ,heightset
   );
   
   });
   
    $('#feature'+rownow+' .image'+rowgnow+' .deleterowbutton').click(function(){
   
    $('#feature'+rownow).remove();

});

}


function openorderlist()
{
$('.ovlPopGen').hide();
var code='';
var code2='';
var code3='';
var textset='';
var showshopname= $('#shopcart-'+useridset+' .showshopname').html();


$('.wrpPopOrdSum .showshopname').html(showshopname);

if($('#shopcart-'+useridset+' .wrpItmLstCart .itmproductids').length)
{

$('#shopcart-'+useridset+' .wrpItmLstCart .itmproductids').each( function( index, element ){

code += '<div class="itmLstCart fs03 clearfix clBd2">\n';
code += '<div class="ct os1 clearfix">\n';
code += '<div class="pdImgCart">\n';
code += '<img alt="img" src="'+$(this).find('img').attr('src')+'">\n';
code += '</div>\n';
code += '<div class="pdNameCart">\n';

code +=$(this).find('.pdNameCart').html();

code += '</div>\n';
code += '</div>\n';
code += '<div class="ct os2 clearfix"><span>'+$(this).find('.pricenowset').html()+'</span></div>\n';
code += '<div class="ct os3 clearfix"><span>'+$(this).find('input[name="quantityset"]').val()+'</span></div>\n';

if($(this).find('input[name="paywithpoint"]').val()=='1')
{
textset='0<em>(Pay with Points)</em>';

}else
{
textset=$(this).find('.priceallset').html();

}

code += '<div class="ct os4 clearfix"><span>'+textset+'</span></div>\n';
code += '</div>';

});






}


$('.wrpPopOrdSum .wrpItmLstCart').html(code);


if($('#shopcart-'+useridset+' .coupondiv .couponcodeitm').length)
{
$('#shopcart-'+useridset+' .coupondiv .couponcodeitm').each( function( index, element ){
code2 += '<div class="itmLstCart fs03 clearfix clBd2">\n';
code2 += '<div class="ct os10 clearfix">\n';
code2 += '<span>'+$(this).find('.c10 span').html()+'</span>\n';
code2 += '</div>\n';
code2 += '<div class="ct os4 clearfix"><span>'+$(this).find('.pricecouponcode').html()+'</span></div>\n';
code2 += '</div>';
});
}

$('.wrpPopOrdSum .coupondiv').html(code2);


$('.wrpPopOrdSum .btnBckOrdSum').attr('onclick','loadpopupship('+useridset+')');


if($('#shopcart-'+useridset+' .transportcart').length)
{
$('#shopcart-'+useridset+' .transportcart').each( function( index, element ){

if($(this).find('input[name="rcCart"]').is(':checked'))
{

code3 += '<div class="itmLstCart fs03 clearfix clBd2">\n';
code3 += '<div class="ct os10">\n';
code3 += '<span>'+$(this).find('.transportnamedata').html()+'</span>\n';
code3 += '</div>\n';
code3 += '<div class="ct os5"><span>'+$(this).find('.c7 span').html()+'</span></div>\n';
code3 += '</div>';

}


});

}





$('.wrpPopOrdSum .transportdiv').html(code3);

$('.wrpPopOrdSum .totalsettext').html($('#shopcart-'+useridset+' .sumallcheck').html());

$('.wrpPopOrdSum .displaynamecart').html($('.wrpPopShipInfo input[name="displayname"]').val());
$('.wrpPopOrdSum .emailcart').html($('.wrpPopShipInfo input[name="emailcontact"]').val());
$('.wrpPopOrdSum .phonecart').html($('.wrpPopShipInfo input[name="phone"]').val());

if($('.wrpPopShipInfo select[name="shipcountryid"]').val()=='210')
{
$('.wrpPopOrdSum .addresscart').html($('.wrpPopShipInfo textarea[name="shipaddress"]').val()+' '+$('.wrpPopShipInfo select[name="shipdisid"] option:selected').text()+' '+$('.wrpPopShipInfo select[name="shiptumid"] option:selected').text()+' '+$('.wrpPopShipInfo select[name="shipproid"] option:selected').text()+' '+$('.wrpPopShipInfo input[name="shipcode"]').val());


}else
{

$('.wrpPopOrdSum .addresscart').html($('.wrpPopShipInfo textarea[name="shipaddress"]').val()+' '+$('.wrpPopShipInfo input[name="shipstate"]').val()+' '+$('.wrpPopShipInfo input[name="shipcode"]').val());


}



$('.wrpPopOrdSum').show();

}
function saveordercart()
{

var arraydata={};
arraydata['userid']=useridset;
arraydata['suborderlist']=new Array();
arraydata['discountlist']=new Array();
arraydata['sumall']=$('#shopcart-'+useridset+' .sumallcheck').html();
arraydata['orderid']=$('#shopcart-'+useridset+' input[name="orderid"]').val();

if($('#shopcart-'+useridset+' input[name="rcCart"]:checked').length!=0)
{
arraydata['tspoid']=$('#shopcart-'+useridset+' input[name="rcCart"]:checked').val();
}

arraydata['note']=$('.wrpPopOrdSum textarea[name="noteinfo"]').val();


var rown=0;
if($('#shopcart-'+useridset+' .wrpItmLstCart .itmproductids').length)
{

$('#shopcart-'+useridset+' .wrpItmLstCart .itmproductids').each( function( index, element ){


arraydata['suborderlist'][rown]={};
//code += '<div class="ct os2 clearfix"><span>'+$(this).find('.pricenowset').html()+'</span></div>\n';
//code += '<div class="ct os3 clearfix"><span>'+$(this).find('input[name="quantityset"]').val()+'</span></div>\n';
arraydata['suborderlist'][rown]['productid']=$(this).find('input[name="productid"]').val();
arraydata['suborderlist'][rown]['suborderid']=$(this).find('input[name="suborderid"]').val();
arraydata['suborderlist'][rown]['qty']=$(this).find('input[name="quantityset"]').val();
arraydata['suborderlist'][rown]['price']=$(this).find('.pricenowset').html();


rown++;

});






}




var rown=0;
if($('#shopcart-'+useridset+' .coupondiv .couponcodeitm').length)
{
$('#shopcart-'+useridset+' .coupondiv .couponcodeitm').each( function( index, element ){


arraydata['discountlist'][rown]={};
arraydata['discountlist'][rown]['productid']=$(this).find('input[name="productcode"]').val();
arraydata['discountlist'][rown]['discount']=$(this).find('.pricecouponcode').html();
arraydata['discountlist'][rown]['title']=$(this).find('.coupontitle').html();


rown++;
//code2 += '<div class="itmLstCart fs03 clearfix clBd2">\n';
//code2 += '<div class="ct os10 clearfix">\n';
//code2 += '<span>'+$(this).find('.c10 span').html()+'</span>\n';
//code2 += '</div>\n';
//code2 += '<div class="ct os4 clearfix"><span>'+$(this).find('.pricecouponcode').html()+'</span></div>\n';
//code2 += '</div>';

});
}

  loaddata();
  $.post(serviceinfo+'saveordertocart', arraydata, function(data) {  
   loadclosedata();   
    if(data.error.response)
    {
    alertbox(data.error.error);

    }else
    {
    
    
     openpopuptranfer(useridset,data.data.orderid);
    emptycartproduct(useridset);
    }
    
  });



}

var paymentobj={};
function openpopuppayment()
{


$('.wrpPopTellPaid .btnTellPaidOrdView').html(paymentobj.data.user.orderprefix+''+paymentobj.orderid);
var code='';

if(paymentobj.data.data.length)
{
$.each(paymentobj.data.data, function(key, value) {
code += '<div class="bankLst">\n';
code += '<input type="radio" value="'+value['tfid']+'"  name="radiopayment" >\n';
code += '<label>'+value['bankname']+' '+value['branch']+' '+value['accnumber']+'</label>\n';
code += '</div>';
});

}

$('.wrpPopTellPaid .banklistdata').html(code);
$('.wrpPopTellPaid input[name="datepay"]').val('');
$('.wrpPopTellPaid select[name="timepay"]').val('');
$('.wrpPopTellPaid select[name="minpay"]').val('');
$('.wrpPopTellPaid input[name="amountbaht"]').val('');
$('.wrpPopTellPaid textarea[name="moredetail"]').val('');
$('.wrpPopTellPaid input[name="imgmid[]"]').val('');
$('.wrpPopTellPaid input[name="simgmid[]"]').val('');

$('.wrpPopTellPaid .plgArea').html('');



$('.wrpPopTellPaid').fadeIn();


}

function sendpaymentuser()
{
var arrayobj={};

arrayobj['orderid']=paymentobj.orderid;
arrayobj['shopid']=paymentobj.userid;
if($('.wrpPopTellPaid input[name="radiopayment"]:checked').length==0)
{
alertwrongboxmsgonly('Please Select Payment');
return false;
}
arrayobj['tfid']=$('.wrpPopTellPaid input[name="radiopayment"]:checked').val();

if($('.wrpPopTellPaid input[name="datepay"]').val()=='')
{
alertwrongboxmsgonly('Please Input Date');
return false;
}
arrayobj['datepay']=$('.wrpPopTellPaid input[name="datepay"]').val();


if($('.wrpPopTellPaid select[name="timepay"]').val()=='')
{
alertwrongboxmsgonly('Please Input Time');
return false;
}
arrayobj['timepay']=$('.wrpPopTellPaid select[name="timepay"]').val();

if($('.wrpPopTellPaid select[name="minpay"]').val()=='')
{
alertwrongboxmsgonly('Please Input Time');
return false;
}
arrayobj['minpay']=$('.wrpPopTellPaid select[name="minpay"]').val();

if($('.wrpPopTellPaid input[name="amountbaht"]').val()=='')
{
alertwrongboxmsgonly('Please Input Amount');
return false;
}
arrayobj['amount']=$('.wrpPopTellPaid input[name="amountbaht"]').val();
arrayobj['detail']=$('.wrpPopTellPaid textarea[name="moredetail"]').val();
arrayobj['imgmid']=$('.wrpPopTellPaid input[name="imgmid[]"]').val();
arrayobj['simgmid']=$('.wrpPopTellPaid input[name="simgmid[]"]').val();
//console.log(arrayobj);
loaddata();
$.post(serviceinfo+'savehistorypayment', arrayobj, function(data) {  
loadclosedata(); 
boxmsgdata('Done');
$('.wrpPopTellPaid').fadeOut();
});






}

function openpopuptranfer(userid,orderid)
{

   $.get(serviceinfo+'gettranferdata', {userid:userid}, function(data) {  
    
    var code='';
    $('.wrpPopHtP .bdTfHtp').html('');
    paymentobj={};
    paymentobj=data;
    paymentobj['orderid']=orderid;
    paymentobj['userid']=userid;
if(data.data.data.length)
{
var code='';
$.each(data.data.data, function(key, value) {

code += '<div class="lstTf clBd2 bdBtm clearfix">\n';
code += '<div class="tf tf1 clearfix">\n';
code += '<span>'+value['bankname']+'</span>\n';
code += '</div>\n';
code += '<div class="tf tf2 clearfix">\n';
code += '<span>'+value['branch']+'</span>\n';
code += '</div>\n';
code += '<div class="tf tf3 clearfix">\n';
code += '<span>'+value['accnumber']+'</span>\n';
code += '</div>\n';
code += '<div class="tf tf4 clearfix">\n';
code += '<span>'+value['typename']+'</span>\n';
code += '</div>\n';
code += '<div class="tf tf5 clearfix">\n';
code += '<span>'+value['accname']+'</span>\n';
code += '</div>\n';
code += '</div>';

});

$('.wrpPopHtP .bdTfHtp').html(code);




}


//var showshopname= $('#shopcart-'+useridset+' .showshopname').html();

var showshopname='<a href="'+baseinfo+'/'+data.data.user.username+'"><img src="'+data.data.user.img.newpath+'" class="genImgShp"><span class="cutTxt clTxt2 fs04" >'+data.data.user.displayname+'</span></a>';
//console.log('#shopcart-'+useridset+' .showshopname');
//console.log(showshopname);
$('.wrpPopHtP .showshopname').html(showshopname);
$('.wrpPopHtP .paypalbtn').attr('href',serviceinfo+'paywithpaypal?orderid='+orderid+'&nojson=1');



$('.wrpPopOrdSum').fadeOut();

$('.wrpPopHtP').fadeIn();
    
    
    });
    


}

function getmyorderlist(pageorderlist,status)
{
var pageorderlistset=1;
var statusset=0;
if(pageorderlist)
{
pageorderlistset=pageorderlist;
}

if(status)
{
statusset=status;
}
loaddata();
$.get(serviceinfo+'getmyorderlist', {page:pageorderlistset,status:statusset}, function(data) {  
loadclosedata();

var code='';
var strtext='';
if(data.data.length)
{

$.each(data.data, function(key, value) {
code += '<div class="itmLstCart fs03 clBd2">\n';
code += '<div class="wrpInOrdHtr clearfix">\n';
code += '<div class="ct o1 clearfix">\n';
code += '<span>'+value['newdate']+'</span>\n';
code += '</div>\n';
code += '<div class="ct o2 boldGen clearfix">\n';
code += '<a href="'+baseinfo+'/'+value['username']+'">'+value['displayname']+'</a>\n';
code += '</div>\n';
code += '<div class="ct o3 boldGen clearfix">\n';
code += '<a href="javascript:void(0)" onclick="getorderlistbyorderid('+value['orderid']+')" class="btnOrdCtmView">'+value['orderprefix']+''+value['orderid']+'</a>\n';
code += '</div>\n';
code += '<div class="ct o4 clearfix">\n';
code += '<span>'+value['sumall']+'</span>\n';
code += '</div>\n';
code += '<div class="ct o5 boldGen clearfix">\n';
strtext='';
if(value['status']=='1')
{
strtext='<span onclick="openpopuptranfer('+value['createby']+','+value['orderid']+')">Reserve <em class="btnOrdHtrHtP">How to Pay</em></span>';

}else if(value['status']=='2')
{
strtext='<span>Paid </span>';

}
else if(value['status']=='3')
{
strtext='<span>Shipped <em class="btnOrdHtrRef" onclick="refnodata('+value['orderid']+')">Ref No.</em></span>';

}
else if(value['status']=='4')
{
strtext='<span>Canceled</span>';

}

code += '<span>'+strtext+'</span>\n';
code += '</div>\n';
code += '</div>\n';
code += '</div>';

});


}
$('.wrprOrdHtr .wrpItmLstCart').html(code);
if(pageorderlistset==1)
{
var param2,param3;
setpaginationnoreverse('.pageat2cart',data.count,5,'getmyorderlist',statusset,param2,param3);

}

});

}


function getmypointorderlist(pageorderlist)
{
var pageorderlistset=1;

if(pageorderlist)
{
pageorderlistset=pageorderlist;
}


loaddata();
$.get(serviceinfo+'getmypointhistory', {page:pageorderlistset}, function(data) {  
loadclosedata();

var code='';
var strtext='';
if(data.data.length)
{

$.each(data.data, function(key, value) {

code += '<div class="wrpInDtCrdHtr clBd2 clearfix">\n';
code += '<div class="ct p1 clearfix"><span>'+value.newdate+'</span></div>\n';
code += '<div class="ct p2 clearfix">\n';
code += '<em>Order ID : </em>\n';
code += '<span class="boldGen">\n';
code += '<a class="btnOrdCtmView">'+value.orderid+'</a>\n';
code += '</span>\n';
code += '</div>\n';
code += '<div class="ct p3 clearfix"><span>-'+value.point+'</span></div>\n';
code += '<div class="ct p4 clearfix"><span>'+value.pointall+'</span></div>\n';
code += '</div>';

});


}
$('.wrprMyPnt .wrpItmLstCart').html(code);
if(pageorderlistset==1)
{
var param1,param2,param3;
setpaginationnoreverse('.pageat3cart',data.count,5,'getmypointorderlist',param1,param2,param3);

}

});

}

function saveshippingnew()
{
     if($("#feature"+rownow+' input[name="displayname"]').val()=='')
     {
     alertwrongboxmsgonly('Please Input Displayname');
     return false;
     }
     else if($("#feature"+rownow+' input[name="emailcontact"]').val()=='')
     {
     alertwrongboxmsgonly('Please Input Email');
     return false;
     }
     else if($("#feature"+rownow+' input[name="phone"]').val()=='')
     {
     alertwrongboxmsgonly('Please Input Phone');
     return false;
     }
     else if($("#feature"+rownow+' textarea[name="shipaddress"]').val()=='')
     {
     alertwrongboxmsgonly('Please Input Address');
     return false;
     }
     else if($("#feature"+rownow+' select[name="shipcountryid"]').val()=='0')
     {
     alertwrongboxmsgonly('Please Select Country');
     return false;
     
     } 
     else   if($("#feature"+rownow+' select[name="shipcountryid"]').val()=='210')
     {
    
    if($("#feature"+rownow+' select[name="shipproid"]').val()=='0')
    {
    alertwrongboxmsgonly('Please Select Province');
     return false;
    
    }
   else  if($("#feature"+rownow+' select[name="shipdisid"]').val()=='0')
    {
    alertwrongboxmsgonly('Please Select District');
     return false;
    
    }
    else  if($("#feature"+rownow+' select[name="shiptumid"]').val()=='0')
    {
    alertwrongboxmsgonly('Please Select Sub District');
     return false;
    
    }
    
     
     
     }  
     else   if($("#feature"+rownow+' select[name="shipcountryid"]').val()!='210')
     {
     
     if($("#feature"+rownow+' input[name="shipstate"]').val()=='')
     {
     alertwrongboxmsgonly('Please Input State');
     return false;
     
     } 
     
     
     }
     
     
     if($("#feature"+rownow+' input[name="shipcode"]').val()=='')
     {
     alertwrongboxmsgonly('Please Input Code');
     return false;
     
     } 
     
     
     
     
     
      
   loaddata();
  $.post(serviceinfo+'savesetting', $('#fullprofileform').serialize(), function(data) {  
   loadclosedata();   
    if(data.error.response)
    {
    alertbox(data.error.error);

    }else
    {
    openorderlist();
    //boxmsgdata('Done');
    }  
  
  
  });
   return false;
 



}

function loadpopupship(userid)
{
$('.wrpPopOrdSum').fadeOut();
useridset=userid;

$.post(serviceinfo+'getmyuser', { select:['displayname','emailcontact','email','emailfacebook','phone','shipaddress','shipcountryid','shipproid','shipdisid','shipstate','shiptumid','shipcode'] }, function(data) {
    
    
           if(data.error.response)
         {
          alertbox(data.error.error);
         
         }else
                  {
         
         if(data['data']['displayname'])$("#feature"+rownow+' input[name="displayname"]').val(data['data']['displayname']);
         
         if(data['data']['emailcontact']!='')
         {
         $("#feature"+rownow+' input[name="emailcontact"]').val(data['data']['emailcontact']);
         }else
         {
         if(data['data']['email'])
         {
         $("#feature"+rownow+' input[name="emailcontact"]').val(data['data']['email']);
         }else
         {
         $("#feature"+rownow+' input[name="emailcontact"]').val(data['data']['emailfacebook']);
         
         }
         
         
         }
         
          
         
         if(data['data']['phone'])$("#feature"+rownow+' input[name="phone"]').val(data['data']['phone']); 
         
         if(data['data']['shipaddress'])$("#feature"+rownow+' textarea[name="shipaddress"]').val(data['data']['shipaddress']); 
       
         if(data['data']['shipcode'])$("#feature"+rownow+' input[name="shipcode"]').val(data['data']['shipcode']); 
       
       
        if(data['data']['shipcountryid'])$("#feature"+rownow+' select[name="shipcountryid"]').val(data['data']['shipcountryid']); 
         
         swicthcountry(data['data']['shipcountryid'],rownow);
         
         if(data['data']['shipcountryid']=='210')
         {
         if(data['data']['shipproid']&&data['data']['shipproid']!="0")
         {

         $("#feature"+rownow+' select[name="shipproid"]').val(data['data']['shipproid']);
         
         var xmlRequest=getdistrict("#feature"+rownow+' select[name="shipdisid"]',"#feature"+rownow+' select[name="shiptumid"]',data['data']['shipproid'],data['data']['shipdisid']);
         
         $("#feature"+rownow+' select[name="shipdisid"]').val(data['data']['shipdisid']);
        // $(document).ajaxComplete(function() {
        
         xmlRequest.complete(function() { 
         
         //alert("second complete"); 
         if(data['data']['shipdisid']&&data['data']['shipdisid']!="0") {gettumbon("#feature"+rownow+' select[name="shiptumid"]',data['data']['shipdisid'],data['data']['shiptumid']);}
         
         });
        
         
     
       //  });
         
        // if(data['data']['tumid']) $("#feature"+rownow+' select[name="tumid[]"]').val(data['data']['tumid']);
         
         }
         }
         else
         {
         
         if(data['data']['shipstate']) $("#feature"+rownow+' input[name="shipstate[]"]').val(data['data']['shipstate']);
         
         }
         
         
         if(data['data']['shipcode']) $("#feature"+rownow+' input[name="shipcode[]"]').val(data['data']['shipcode']);
         
         
         $('.wrpPopShipInfo').fadeIn();
         }
    
    
    });

}

function paywithpoint()
{
loaddata();
$.post(serviceinfo+'paywithpoint', { userid:shopid,productid:productidset,qty:quantityset,orderid:orderid,suborderid:suborderid}, function(data) { 
loadclosedata();
if(data.error.response)
{
if(data.error.error[0].code==5)
{
$('.ovlPopLd').hide();
$('.wrpPopLI').fadeIn();

//console.log('test');
}else
{
//alertbox(data.error.error);

//alertbox();

$('.wrpPopPayWithPoint .clErrTxt.boldGen').html(data.error.error[0].msg);

}

}else
{

$('#shopcart-'+shopid+' input[name="orderid"]').val(data.data.orderid);
$('#productids-'+productidset+' input[name="suborderid"]').val(data.data.suborderids[0]);

$('#productids-'+productidset+' .paywithpointdatabtn').remove();
$('#productids-'+productidset+' .wrpIcoRmvCart').remove();
$('#productids-'+productidset+' .increproductq button').remove();
$('#productids-'+productidset+' .paytextdata').append('Pay With Points');




$('#productids-'+productidset+' input[name="paywithpoint"]').val(1);
calalldata(shopid);
boxmsgdata('Success');
$('.wrpPopPayWithPoint').fadeOut();
}



});


}

function addCommas(NumberStr)
{
    NumberStr+= '';
    NumberData = NumberStr.split('.');
    Number1 = NumberData[0];
    Number2 = NumberData.length > 1 ? '.' + NumberData[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(Number1)) {
        Number1 = Number1.replace(rgx, '$1' + ',' + '$2');
    }
    return Number1 + Number2;
}

function changetabcart(tabset)
{

if(tabset=='wrprOrdHtr')
{

getmyorderlist();

}
else if(tabset=='wrprMyPnt')
{

getmypointorderlist();

}
$('.carttab').hide();
$('.'+tabset).show();
$('.tgHdGen.tgCl.clBd2').removeClass('clSp2');


$('#set-'+tabset).addClass('clSp2');


}


function calalldata(userid)
{
var sumall=0;

if($('#shopcart-'+userid+' .itmproductids').length)
{

$('#shopcart-'+userid+' .itmproductids').each( function( index, element ){

var paywithpoint= $('#shopcart-'+userid+' input[name="paywithpoint"]').val();
paywithpoint=parseInt(paywithpoint,10);

if(paywithpoint==0)
{


var priceallset=parseInt($(this).find('.priceallset').html(),10);

sumall=sumall+priceallset;

}


});

}



if($('#shopcart-'+userid+' .transportcart').length)
{
$('#shopcart-'+userid+' .transportcart').each( function( index, element ){

if($(this).find('input[name="rcCart"]').is(':checked'))
{
sumall=sumall+parseInt($(this).find('.ct.c7 span').html(),10);

}

});


}


if($('#shopcart-'+userid+' .couponcodeitm').length)
{
$('#shopcart-'+userid+' .couponcodeitm').each( function( index, element ){

var pricecoupon=parseInt($(this).find('.pricecouponcode').html(),10);

sumall=sumall+pricecoupon;


});


}






$('#shopcart-'+userid+' .sumallcheck').html(sumall);





}
function removecoupon(userid,productid)
{
$('#couponcode-'+productid).remove();
calalldata(userid);

}
function increquantity(userid,productid)
{
var quantity=$('#productids-'+productid+' input[name="quantityset"]').val();
quantity=parseInt(quantity,10);
quantity++;
$('#productids-'+productid+' input[name="quantityset"]').val(quantity);
var pricenow=$('#productids-'+productid+' .pricenowset').html();
pricenow=parseInt(pricenow,10);


pricenow=pricenow*quantity;

$('#productids-'+productid+' .priceallset').html(pricenow);







calalldata(userid);
}
function decrequantity(userid,productid)
{

var quantity=$('#productids-'+productid+' input[name="quantityset"]').val();
quantity=parseInt(quantity,10);
quantity--;
if(quantity<0)
{

}else
{
$('#productids-'+productid+' input[name="quantityset"]').val(quantity);
var pricenow=$('#productids-'+productid+' .pricenowset').html();
pricenow=parseInt(pricenow,10);


pricenow=pricenow*quantity;

$('#productids-'+productid+' .priceallset').html(pricenow);



calalldata(userid);
}

}
function removeitemproduct(userid,productid)
{
loaddata();
$.post(serviceinfo+'removeitemproduct', { userid:userid,productid:productid}, function(data) { 
loadclosedata();

$('#productids-'+productid).remove();
calalldata(userid);


if($('#shopcart-'+userid+' .itmproductids').length)
{


}else
{

$('#shopcart-'+userid+'').remove();

}
boxmsgdata('Success');


});


}
function emptycartproduct(userid)
{
loaddata();
$.post(serviceinfo+'emptycartproduct', { userid:userid}, function(data) { 
loadclosedata();





$('#shopcart-'+userid+'').remove();
boxmsgdata('Success');


});

}

function getorderlistbyorderid(orderid)
{
loaddata();
$.get(serviceinfo+'getordermemberbyorderid', {orderid:orderid}, function(data) {  
loadclosedata();
 if(data.error.response)
        {
        if(data.error.error[0].code==5)
        {
        $('.ovlPopLd').hide();
        $('.wrpPopLI').fadeIn();

        //console.log('test');
        }
        
        }else
        {
$('.wrpPopOrdCtmView .ordertext').html('Order ID : '+data.data.orderprefix+''+data.data.orderid);
$('.wrpPopOrdCtmView .displayshop').html('<a target="_blank" href="'+baseinfo+'/'+data.data.username+'"><img src="'+data.data.simg.newpath+'" class="genImgShp"><span class="cutTxt clTxt2 fs04" >'+data.data.displayname+'</span></a>');

var statusset='';
if(data.data.status=='1')
 {
    statusset='Reserve';
 }
 else if(data.data.status=='2')
 {
    statusset='Paid';
 
 }
 else if(data.data.status=='3')
 {
    statusset='Shipped';
 
 }
 else if(data.data.status=='4')
 {
    statusset='Canceled';
 
 }

 
 

$('.wrpPopOrdCtmView .statusorder').html(statusset);
$('.wrpPopOrdCtmView .orderdate').html(data.data.newdate);

var code='';
var code2='';
if(data.data.suborder.length)
{

$.each(data.data.suborder, function(key2, value2) {

if(value2.discount=='0.00')
{

code += '<div class="itmLstCart fs03 clearfix clBd2">\n';
code += '<div class="ct os1 clearfix">\n';
code += '<div class="pdImgCart">\n';
var imgpath=value2.simg;
code += '<img alt="img" src="'+imgpath.newpath+'">\n';
code += '</div>\n';
code += '<div class="pdNameCart">\n';
code += '<a class="boldGen" href="'+baseinfo+'/post/'+value2.productid+'">'+value2.title+'</a>\n';
code += '</div>\n';
code += '</div>\n';
code += '<div class="ct os2 clearfix"><span>'+value2.price+'</span></div>\n';
code += '<div class="ct os3 clearfix"><span>'+value2.count+'</span></div>\n';
code += '<div class="ct os4 clearfix"><span>'+value2.sum+'</span></div>\n';
code += '</div>';
}else
{

code2 += '<div class="itmLstCart fs03 clearfix clBd2">\n';
code2 += '<div class="ct os10 clearfix">\n';
code2 += '<span>'+value2.title+'</span>\n';
code2 += '</div>\n';
code2 += '<div class="ct os4 clearfix"><span>-'+value2.discount+'</span></div>\n';
code2 += '</div>';

}

});

}




$('.wrpPopOrdCtmView .cartitemwrp').html(code);
$('.wrpPopOrdCtmView .conponcart').html(code2);
var code3='';
if(data.data.transport.tspoid)
{
code3 += '<div class="ct os10">\n';
code3 += '<span>'+data.data.transport.tspname+'</span>\n';
code3 += '</div>\n';
code3 += '<div class="ct os5"><span>'+data.data.transport.tspcost+'</span></div>';
}

$('.wrpPopOrdCtmView .transportproduct').html(code3);

$('.wrpPopOrdCtmView .totalpricedata').html(data.data.sumall);

$('.wrpPopOrdCtmView .displaynameshow').html(data.data.customer.displayname);
$('.wrpPopOrdCtmView .emailshow').html(data.data.customer.emailcontact);
$('.wrpPopOrdCtmView .phoneshow').html(data.data.customer.phone);
$('.wrpPopOrdCtmView .addressshow').html(data.data.customer.shipaddressall);

$('.wrpPopOrdCtmView .noteshow').html(data.data.note);

$('.wrpPopOrdCtmView .howtopaybtn').attr('onclick','openpopuptranfer('+data.data.createby+','+data.data.orderid+')');


var code='';
if(data.data.userpay.length)
{

$.each(data.data.userpay, function(key, value) {

code += '<div class="bdShipInfo fs03">\n';
code += '<div class="showShipInfo clearfix">\n';
code += '<span class="si1 boldGen">Inform Date</span>\n';
code += '<span class="si2">'+value.newcreatedate+'</span>\n';
code += '</div>\n';
code += '<div class="showShipInfo clearfix">\n';
code += '<span class="si1 boldGen">Channel</span>\n';
code += '<span class="si2">Transfer : '+value.bankname+' '+value.branch+' '+value.accnumber+'</span>\n';
code += '</div>\n';
code += '<div class="showShipInfo clearfix">\n';
code += '<span class="si1 boldGen">Payment Date</span>\n';
code += '<span class="si2">'+value.newdatepay+'</span>\n';
code += '</div>\n';
code += '<div class="showShipInfo clearfix">\n';
code += '<span class="si1 boldGen">Payment Time</span>\n';
code += '<span class="si2">'+value.newtimedatepay+'</span>\n';
code += '</div>\n';
code += '<div class="showShipInfo clearfix">\n';
code += '<span class="si1 boldGen">Amount</span>\n';
code += '<span class="si2">'+value.amount+' Baht</span>\n';
code += '</div>\n';
code += '<div class="showShipInfo clearfix">\n';
code += '<span class="si1 boldGen">More Details</span>\n';
code += '<span class="si2">'+value.detail+'</span>\n';
code += '</div>\n';
code += '<div class="showShipInfo clearfix">\n';
code += '<span class="si1 boldGen">Attrach File</span>\n';
var imgpath=value.simg;
code += '<span class="si2"><img alt="" src="'+imgpath.newpath+'"></span>\n';
code += '</div>\n';
code += '</div>';

})
}

$('.wrpPopOrdCtmView .userpayshow').html(code);
$('.wrpPopOrdCtmView').fadeIn();






//$.each(data.data, function(key, value) {


//});


}



});

}

function openpaywithpoint(userid,productid,point)
{

shopid=userid;
productidset=productid;


var quantity=$('#productids-'+productid+' input[name="quantityset"]').val();
quantity=parseInt(quantity,10);
quantityset=quantity;

suborderid=$('#productids-'+productid+' input[name="suborderid"]').val();
orderid=$('#shopcart-'+userid+' input[name="orderid"]').val();

$('#payitem').html('This item need '+addCommas(point*quantity)+' points.');
$('.wrpPopPayWithPoint .clErrTxt.boldGen').html('');

$('.wrpPopPayWithPoint').fadeIn();


}


function postcredit(userid)
{
    var code=$('#shopcart-'+userid+' input[name="creditcode"]').val();
    if(code)
    {
     loaddata();
     $.post(serviceinfo+'checkcodethepromotionuser', {code:code,userid:userid}, function(data) { 
     loadclosedata();
     if(data.error.response)
        {
        if(data.error.error[0].code==5)
        {
        $('.ovlPopLd').hide();
        $('.wrpPopLI').fadeIn();

        //console.log('test');
        }else
        {
        //alertbox(data.error.error);

        alertbox(data.error.error);
        }

        }
     else
     {
     
     if($( "#couponcode-"+data.data.productid ).length)
            {
            alertwrongboxmsgonly('You Have Already Coupon Code');
            
            }else
            {
            var code='';
     
            code += '<div class="itmLstCart fs03 clearfix clBd2 couponcodeitm" id="couponcode-'+data.data.productid+'" >\n';
            code += '<div class="ct c10 clearfix">\n';
            code += '<span class="coupontitle">'+data.data.title+'</span>\n';
            code += '</div>\n';
            code += '<div class="ct c4 clearfix"><span class="pricecouponcode">-'+data.data.price+'</span></div>\n';
            code += '<div class="ct c5 clearfix">\n';
            code += '<div class="wrpIcoRmvCart" onclick="removecoupon('+userid+','+data.data.productid+')">\n';
            code += '<span class="ico icoRmvCart"></span>\n';
            code += '</div>\n';
            code += '</div>\n';
            
            code +='<input type="hidden" name="productcode" value="'+data.data.productid+'">';
            
            code += '</div>';
            
            $('#shopcart-'+userid+' .coupondiv').append(code);
            
            calalldata(userid);
            
            }
            
     
     }
     
     
     });
    }else
    {
    
    alertwrongboxmsgonly('Please Add Credit');
    
    
    }

}


</script>


